package com.snowflake.ecatalog.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.snowflake.ecatalog.entity.GoodsCategory;

/**
 * 商品分类
 */
public interface GoodsCategoryDao extends PagingAndSortingRepository<GoodsCategory, Long>,
		JpaSpecificationExecutor<GoodsCategory> {
	@Modifying
	@Query("update GoodsCategory gc set gc.status = ?1 where gc.id=?2")
	void changeStatus(Integer status, Long id);

	List<GoodsCategory> findByStatus(int status);
	
	List<GoodsCategory> findByProfileIdAndStatus(Long profileId, int status);
}
